/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Anali
 */
@Entity
@Table(name = "rolareamodulo")
@NamedQueries({
    @NamedQuery(name = "Rolareamodulo.findAll", query = "SELECT r FROM Rolareamodulo r"),
    @NamedQuery(name = "Rolareamodulo.findModulo", query = "SELECT r FROM Rolareamodulo r WHERE r.area = :area AND r.rol=:rol"),
    @NamedQuery(name = "Rolareamodulo.findAR", query = "SELECT r FROM Rolareamodulo r WHERE r.area = :area AND r.rol=:rol"),
    @NamedQuery(name = "Rolareamodulo.findByIdRolAreaModulo", query = "SELECT r FROM Rolareamodulo r WHERE r.idRolAreaModulo = :idRolAreaModulo"),
    @NamedQuery(name = "Rolareamodulo.findByIdRolArea", query = "SELECT r FROM Rolareamodulo r WHERE r.area = :area AND r.rol = :rol"),
    @NamedQuery(name = "Rolareamodulo.findByVisible", query = "SELECT r FROM Rolareamodulo r WHERE r.visible = :visible")})
public class Rolareamodulo implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idRolAreaModulo")
    private Integer idRolAreaModulo;
    @Column(name = "Visible")
    private Boolean visible;
    @JoinColumn(name = "idModulo", referencedColumnName = "idModulo")
    @ManyToOne(optional = false)
    private Modulo modulo;
    @JoinColumn(name = "idArea", referencedColumnName = "idArea")
    @ManyToOne(optional = false)
    private Area area;
    @JoinColumn(name = "idRol", referencedColumnName = "idRol")
    @ManyToOne(optional = false)
    private Rol rol;

    public Rolareamodulo() {
    }

    public Rolareamodulo(Integer idRolAreaModulo) {
        this.idRolAreaModulo = idRolAreaModulo;
    }

    public Integer getIdRolAreaModulo() {
        return idRolAreaModulo;
    }

    public void setIdRolAreaModulo(Integer idRolAreaModulo) {
        this.idRolAreaModulo = idRolAreaModulo;
    }

    public Boolean getVisible() {
        return visible;
    }

    public void setVisible(Boolean visible) {
        this.visible = visible;
    }

    public Modulo getModulo() {
        return modulo;
    }

    public void setModulo(Modulo modulo) {
        this.modulo = modulo;
    }

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }

    public Rol getRol() {
        return rol;
    }

    public void setRol(Rol rol) {
        this.rol = rol;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRolAreaModulo != null ? idRolAreaModulo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Rolareamodulo)) {
            return false;
        }
        Rolareamodulo other = (Rolareamodulo) object;
        if ((this.idRolAreaModulo == null && other.idRolAreaModulo != null) || (this.idRolAreaModulo != null && !this.idRolAreaModulo.equals(other.idRolAreaModulo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Rolareamodulo[idRolAreaModulo=" + idRolAreaModulo + "]";
    }
}
